<template>
  <div class="recruit_index_new">
    <van-sticky>
      <van-nav-bar title="人才招聘" left-arrow @click-left="back" />
    </van-sticky>
    <div class="search">
      <label for="" style="font-size:0.22rem">
        企业名称
      </label>
      <input type="text" v-model="form.data.entName" style="font-size:0.22rem" placeholder="请输入关键字">
      <van-icon name="cross" @click="form.data.entName = ''" />
      <span @click="search" style="font-size:0.22rem">搜索</span>
    </div>
    <div class="list">
      <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="load">
        <div tag="div" @click="company(item)" class="company flex" v-for="(item,index) in dataList" :key="index">
          <div class="logo">
			  <img :src="item.logoUrl"  style="width: 100%; height: 100%;" alt="">
		  </div>
          <div class="infor">
            <h4 class="name">{{item.entName}}111</h4>
			
            <div class="tags flex">
              <span class="type1 row-between-center"><i class="icon"></i>{{item.levelName}}</span>
              <!-- <span class="type2"> 政府机关</span> -->
              <span class="type2">{{item.industryTypeCN}}</span>
            </div>
            <div class="address flex">
              <i class="icon_address"></i>
              <span class="text">{{item.regionName}}</span>
            </div>
			<div class="btn" v-if="item.levelName=='高级认证'">立即查看</div>
			<div class="btn" v-if="item.levelName!='高级认证'">意向咨询</div>
            <div class="hot van-hairline--top row-between-center">
              <span>{{item.hotRecruitment}}</span>
              <van-icon name="arrow" />
            </div>
          </div>
        </div>
      </van-list>
    </div>
  </div>
</template>

<script>
import api from 'api/api'
export default {
  data () {
    return {
      loading: false,
      finished: false,
      dataList: [],
      form:{
        page:0,
        data:{
          entName:''
        }
      }
    }
  },
  methods: {
    search(){
      this.loading = false
      this.finished = false
      this.form.page = 0
      this.dataList = []
      // this.load()
    },
    load(){
     this.form.page++
     this.getData()
    },
    getData () {
      this.loading = true
      api.jobList(this.form).then(res => {
        this.loading = false
        this.dataList = this.dataList.concat(res.data.records)
        if(res.data.records.length == 0){
            this.finished = true
        }
      })
    },
	company(item){
	var level=localStorage.getItem('level')
	if(item.levelName=='高级认证'){
			this.$router.push('/company/' + item.id)
	}
	else if(item.levelName=='普通认证'){
				this.$router.push('/online/'+item.id)
	}
		// :to="{path:`/company/${item.id}`}"
	},
    back () {
      window.history.go(-1)
    }
  }
}
</script>

<style lang="scss">
.recruit_index_new {
  background-color: #f5f5f5;
  min-height: 100vh;
    .search {
    width: 6.9rem;
    margin: 0.2rem auto;
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.32rem;
    padding: 0.1rem 0.2rem;
    border-radius: 0.5rem;
    label {
      display: flex;
      align-items: center;
      i {
        transform: rotate(90deg);
      }
    }
    input {
      flex: auto;
      margin: 0 0 0 0.2rem;
      padding: 0.1rem 0.2rem;
      background: none;
    }
    span {
      margin-left: 0.2rem;
    }
  }
  .list {
    .company {
      padding: 0.27rem 0.27rem 0.41rem 0.27rem;
      background-color: #fff;
      margin-bottom: 0.17rem;
      position: relative;
      .logo {
        width: 1rem;
        height: 1rem;
        background-image: url("../../../assets/img/home/logo .png");
        background-size: cover;
      }
      .infor {
        text-align: left;
        margin-left: 0.2rem;
        flex: auto;
        .name {
          font-size: 0.3rem;
        }
        .tags {
          margin: 0.2rem 0;
          span {
            margin-right: 0.21rem;
            padding: 0.03rem 0.2rem;
          }
          .type1 {
            background: rgba(255, 241, 231, 1);
            border-radius: 0.07rem;
            color: #ff8a34;
            font-size: 0.22rem;
            .icon {
              width: 0.2rem;
              height: 0.23rem;
              background: url("../../../assets/img/home/renzheng .png");
              background-size: contain;
              background-repeat: no-repeat;
              background-position: center;
              margin-right: 0.05rem;
            }
          }
          .type2 {
            background: rgba(239, 246, 255, 1);
            border-radius: 7px;
            color: #348aff;
            font-size: 0.22rem;
            // padding: 0.1rem;
          }
        }
        .address {
          align-items: center;
          .icon_address {
            width: 0.27rem;
            height: 0.24rem;
            background: url("../../../assets/img/home/map.png");
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
            margin-right: 0.1rem;
          }
          .text {
            font-size: 0.22rem;
          }
        }
      }
      .hot {
        font-size: 0.22rem;
        padding-top: 0.1rem;
        margin-top: 0.1rem;
        strong {
          color: #348aff;
          font-weight: 400;
        }
      }
	.btn {
	  position: absolute;
	  right: 0.27rem;
	  bottom: 1.27rem;
	  width: 1.46rem;
	  padding: 0.1rem 0.1rem;
	  line-height: 1;
	  text-align: center;
	  font-size: 0.28rem;
	  color: #fffefe;
	  background: linear-gradient(
	    96deg,
	    rgba(72, 143, 240, 1),
	    rgba(51, 130, 239, 1)
	  );
	  border-radius: 0.25rem;
	}
    }
  }
}
</style>